'use strict'

const Service = require('egg').Service;

class StarService extends Service {

	get tbname(){
		return 'yz_star';
	}

	async add(data){
		// let test = {"width":100, "height":300, "uri":'https://i.imgur.com/UYiroysl.jpg'};
		// const result = await app.mysql.insert('yz_product',{
		// 	depid:1,
		// 	uid:1,
		// 	title:'测试产品3',
		// 	status:1,
		// 	type:3,
		// 	content:'热门产品2',
		// 	image: JSON.stringify(test),
		// 	ctime:'2019-01-02 18:42:45',
		// });
		const { app } = this;
		const result = await app.mysql.insert(this.tbname, data);
		return result;
	}

	async delete(data){
		const { app } = this;
		const result = await app.mysql.delete(this.tbname, data);
		return result;
	}
}

module.exports = StarService;